/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package duplicateur;

import javax.swing.JProgressBar;

/**
 *
 * @author Aurélie
 */
public class ThreadControleCopy extends Thread {
    private ThreadCopy[] tabThread;
    private InterfaceDuplicateur interfaceD;
    
    public ThreadControleCopy(ThreadCopy[] tabThread, InterfaceDuplicateur interfaceD) {
        this.tabThread = tabThread;
        this.interfaceD = interfaceD;
    }
    
    public void run() {
        while (interfaceD.getNbThreadEnd() < interfaceD.getNbThread()) {
//            System.out.println("end : "+interfaceD.getNbThreadEnd());
//            System.out.println("nb : "+interfaceD.getNbThread());
        }
        interfaceD.endCopy();
        this.interrupt();
    }
    
    public void stopThreads() {
        for(int i = 0; tabThread[i] != null; i++) {
            tabThread[i].stop();
        }
    }
}
